package com.lanou.controller;

import com.github.pagehelper.PageInfo;
import com.lanou.bean.Designer;
import com.lanou.bean.ProductPhoto;
import com.lanou.mapper.ProductPhotoMapper;
import com.lanou.service.DesignerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lanou.utils.AjaxResult;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dllo on 18/3/13.
 */
@Controller
public class DesignerController {

    @Resource
    private DesignerService designerService;

    /**
     * 徐鸣
     * @param pageNo 第几页
     * @param pageSize 显示几条数据
     * @param id 公司id
     * @return  返回根据公司id返回的此公司所有设计师资料
     */
    @ResponseBody
    @RequestMapping(value = "/findDesignerByComIdPage")
    public AjaxResult findDesignerByComIdPage(@RequestParam (value = "pageNo",required = false) Integer pageNo,
                                               @RequestParam (value = "pageSize",required = false) Integer pageSize,
                                               @RequestParam (value = "id") String id){

        return  new AjaxResult("200","1.0",designerService.findDesignerByComId(pageNo,pageSize,id));
    }

    /**
     * 徐鸣
     * @param pageNo 第几页
     * @param pageSize 显示几条数据
     * @param teamId 团队id
     * @return  根据团队id查询所有设计师
     */
    @ResponseBody
    @RequestMapping(value = "/findDesignerByTeamIdPage")
    public AjaxResult findDesignerByTeamIdPage(@RequestParam (value = "pageNo",required = false) Integer pageNo,
                                                       @RequestParam (value = "pageSize",required = false) Integer pageSize,
                                                       @RequestParam (value = "id") Integer teamId){
        return new AjaxResult("200","1.0",designerService.findDesignerByTeamId(pageNo,pageSize,teamId));
    }

    /**
     * 徐鸣
     * @param id
     * @return 根据设计师id返回设计师详细资料
     */
    @ResponseBody
        @RequestMapping(value = "/findDesignerById")
    public AjaxResult findDesignerById(@RequestParam (value = "id",required = false) Integer id){
       return new AjaxResult("200","1.0",designerService.findDesignerById(id));
    }
}
